package com.mmy.service.impl.visa;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
/**
*类的介绍：签证订单信息 
*
*@author 	hanxl
*@date		2020-07-23
*@version		1.0
*/
import org.springframework.stereotype.Service;

import com.mmy.dao.visa.TVisaOrderRepository;
import com.mmy.domain.visa.TVisaOrder;
import com.mmy.service.visa.TVisaOrderService;

@Service
public class TVisaOrderServiceImpl implements TVisaOrderService {
	@Autowired
	private TVisaOrderRepository tVisaOrderRepository;

	/**
	 * 获取最大流水号
	 * 
	 * @return 返回值说明 流水号
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.17
	 */
	public int getMaxID() {
		// 流水号
		Object objCode = tVisaOrderRepository.getMaxID();
		int iID = 0;
		if (objCode != null) {
			iID = Integer.parseInt(objCode.toString());
		}
		return iID;
	}

	/**
	 * 获取订单最大编码
	 * 
	 * @param 参数说明 计划单编码
	 * @return 返回值说明 订单编码
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.17
	 */
	public String getMaxCode(int iPlanID) {
		// int 转 string
		String strPlanID = String.valueOf(iPlanID);
		// 返回订单最大编码
		Object objCode = tVisaOrderRepository.getMaxCode(strPlanID);
		String strCode = "";
		if (objCode != null) {
			strCode = objCode.toString();
		}
		return strCode;
	}

	public void save(TVisaOrder tVisaOrder) {
		// TODO Auto-generated method stub
		tVisaOrderRepository.save(tVisaOrder);
	}

	public List<TVisaOrder> findByOrderState0() {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByOrderState0();
	}

	public List<TVisaOrder> findByOrderState3() {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByOrderState3();
	}

	/* 搜索预约单 订单状态为0 */
	public List<TVisaOrder> findByName(String reserveName) {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByName(reserveName);
	}

	/**
	 * 新增id
	 * 
	 * @param
	 * @return
	 */
	public void save(int id) {
		// TODO Auto-generated method stub
		tVisaOrderRepository.save(id);
	}

	/**
	 * id查找
	 * 
	 * @param
	 * @return
	 */
	public TVisaOrder findByID(int iID) {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByID(iID);
	}

	/**
	 * visaid查找
	 * 
	 * @param
	 * @return
	 */
	public List<TVisaOrder> findByVisaID(int iVisaID) {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByVisaID(iVisaID);
	}

	/**
	 * 删除
	 * 
	 * @param
	 * @return
	 */
	public void delVisaOrder(List<Integer> lstID) {
		// TODO Auto-generated method stub
		tVisaOrderRepository.delVisaOrder(lstID);
	}

	/**
	 * 出纳查询
	 * 
	 * @param
	 * @return
	 */
	public List<TVisaOrder> findByCashierAndVisaID(String strCashierState, int iVisaID) {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByCashierAndVisaID(strCashierState, iVisaID);
	}

	/**
	 * 查找全部
	 * 
	 * @param
	 * @return
	 */
	public List<TVisaOrder> findAll() {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findAll();
	}

	/**
	 * 会计查询
	 * 
	 * @param
	 * @return
	 */
	public List<TVisaOrder> findByAccountAndVisaID(String strAccountState, int iVisaID) {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByAccountAndVisaID(strAccountState, iVisaID);
	}

	public List<TVisaOrder> findByOrderState24() {
		// TODO Auto-generated method stub
		return tVisaOrderRepository.findByOrderState24();
	}

	public void saveAll(List<TVisaOrder> lstCashier) {
		// TODO Auto-generated method stub
		tVisaOrderRepository.saveAll(lstCashier);
	}

	/* 个人中心通过登录人获取签证预留 */
	public List<TVisaOrder> findByUserID(int userID) {
		// TODO Auto-generated method stub
		// return tVisaOrderRepository.findByUserID(userID);
		return null;
	}

	/* 个人中心通过登录人获取签证订单 */
	public List<TVisaOrder> findByOrderUserID(int userID) {
		// TODO Auto-generated method stub
		// return tVisaOrderRepository.findByOrderUserID(userID);
		return null;
	}

	/* 个人中心通过登录人获取签证退单 */
	public List<TVisaOrder> findByChargeBackUserID(int userID) {
		// TODO Auto-generated method stub
		// return tVisaOrderRepository.findByChargeBackUserID(userID);
		return null;
	}

}
